#include<stdio.h>

int main(void)
{
    int n;
    scanf("%d",&n);

    for (int i = 0; i < n; i++)
    {
        int a,b,c1=1,c2=1;
        scanf("%d %d",&a,&b);

        if (a<b)
        {
            printf("0\n");
        }
        else if (a==b||b==0)
        {
            printf("1\n");
        }
        else
        {
            for (int j = b; j <= a ; j++)
            {
                c1*=j;
            }
            for (int k = 1; k <= b; k++)
            {
                c2*=k;
            }
            printf("%d\n",c1/c2);
            
        }
    }
    
}